package com.hzvdvmc.autosale.util;

import android.os.Environment;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by william on 2018/1/10.
 */

public class FileHelper {

    private static String path = null;

    static {
        path = Environment.getExternalStorageDirectory().getPath() + "/adver/";
    }

    public static String getAdverTopPath() {
        File file = new File(path + "video");
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            if (files.length > 0) {
                return files[0].getPath();
            }
        }
        return "";
    }

    public static List<String> getAdverBottomUrlList() {
        List<String> urlList = new ArrayList<>();
        File file = new File(path + "banner");
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            for (File f : files) {
               urlList.add(f.getPath());
            }
        }
        return urlList;
    }

    public static String getAdverOutPath() {
        File file = new File(path + "video_out");
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            if (files.length > 0) {
                return files[0].getPath();
            }
        }
        return null;
    }

    public static List<String> getAdverWaitBannerUrlList() {
        List<String> urlList = new ArrayList<>();
        File file = new File(path + "waitbanner");
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            for (File f : files) {
                urlList.add(f.getPath());
            }
        }
        return urlList;
    }


}
